package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.YxAdvertisementMapper;
import com.ruoyi.system.domain.YxAdvertisement;
import com.ruoyi.system.service.IYxAdvertisementService;

/**
 * 首页广告Service业务层处理
 * 
 * @author lingyu
 * @date 2024-03-06
 */
@Service
public class YxAdvertisementServiceImpl implements IYxAdvertisementService 
{
    @Autowired
    private YxAdvertisementMapper yxAdvertisementMapper;

    /**
     * 查询首页广告
     * 
     * @param id 首页广告主键
     * @return 首页广告
     */
    @Override
    public YxAdvertisement selectYxAdvertisementById(Long id)
    {
        return yxAdvertisementMapper.selectYxAdvertisementById(id);
    }

    /**
     * 查询首页广告列表
     * 
     * @param yxAdvertisement 首页广告
     * @return 首页广告
     */
    @Override
    public List<YxAdvertisement> selectYxAdvertisementList(YxAdvertisement yxAdvertisement)
    {
        return yxAdvertisementMapper.selectYxAdvertisementList(yxAdvertisement);
    }

    /**
     * 新增首页广告
     * 
     * @param yxAdvertisement 首页广告
     * @return 结果
     */
    @Override
    public int insertYxAdvertisement(YxAdvertisement yxAdvertisement)
    {
        yxAdvertisement.setCreateTime(DateUtils.getNowDate());
        return yxAdvertisementMapper.insertYxAdvertisement(yxAdvertisement);
    }

    /**
     * 修改首页广告
     * 
     * @param yxAdvertisement 首页广告
     * @return 结果
     */
    @Override
    public int updateYxAdvertisement(YxAdvertisement yxAdvertisement)
    {
        return yxAdvertisementMapper.updateYxAdvertisement(yxAdvertisement);
    }

    /**
     * 批量删除首页广告
     * 
     * @param ids 需要删除的首页广告主键
     * @return 结果
     */
    @Override
    public int deleteYxAdvertisementByIds(Long[] ids)
    {
        return yxAdvertisementMapper.deleteYxAdvertisementByIds(ids);
    }

    /**
     * 删除首页广告信息
     * 
     * @param id 首页广告主键
     * @return 结果
     */
    @Override
    public int deleteYxAdvertisementById(Long id)
    {
        return yxAdvertisementMapper.deleteYxAdvertisementById(id);
    }
}
